/**
 * @author LiuWeiNing
 * @version 0.1
 * 
 */

package controller.action;
import model.service.UserService;
import model.service.registService;

import com.opensymphony.xwork2.ActionSupport;


//controller
public class regist extends ActionSupport{
	private String result;//return 
	private String userInfo;//JSON data
	private registService registServ;
	private UserService userService;
	private int pageNum;
	private String userId;
	private int epId;
	
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public void setEpId(int epId) {
		this.epId = epId;
	}
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	public String getResult() {
		return result;
	}
	public void setUserInfo(String userInfo) {
		this.userInfo = userInfo;
	}
	
	public void setRegistServ(registService registServ) {
		this.registServ = registServ;
	}
	public String sign()
	{
		System.out.println(userInfo);
		result = userService.changeInfo(userInfo,"sign");
		return SUCCESS;
	}
	public String regist()
	{
		System.out.println(userInfo);
		result = registServ.regist(userInfo);
		return SUCCESS;
	}
	public String add()
	{
		result = userService.addUser(userInfo);
		return SUCCESS;
	}
	public String modify(){
		result = userService.changeInfo(userInfo,"modify");
		return SUCCESS;
	}
	public String getList(){
		result = userService.getList(pageNum);
		return SUCCESS;
	}
	public String delete()
	{
		result = userService.deleteAll(userInfo);
		return SUCCESS;
	}
	public String changeState()
	{
		result = userService.changeState(userInfo);
		return SUCCESS;
	}
	public String allocateAdmitId(){
		result = userService.allocateRegistId();
		return SUCCESS;
	}
	public String allocateEP()
	{
		result = userService.allocatedAll();
		return SUCCESS;
	}
	public String query()
	{
		result = userService.queryByName(userInfo);
		return SUCCESS;
	}
	public String chooseEp(){
		result = userService.ChooseEP(userId, epId);
		return SUCCESS;
	}
}
